package com.poly.bejeweled;

import java.util.Map;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
 
public class ScoreActivity extends Activity {
	
	private TextView edittext;
	private int[] id = {R.id.textView11,R.id.textView12,R.id.textView21,R.id.textView22,R.id.textView31,R.id.textView32,R.id.textView41,R.id.textView42,R.id.textView51,R.id.textView52,};
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_score);
  SharedPreferences sharedPref = getSharedPreferences("LevelScores", 
	        Context.MODE_PRIVATE);
	Map<String, ?> keys = sharedPref.getAll();
	int idCounter = 0;
	for (String s : keys.keySet()) {
		//set name
        View v = findViewById(id[idCounter]);
        idCounter++;
        edittext = (TextView) v;
        edittext.setText(s);
		//set score
        View v2 = findViewById(id[idCounter]);
        idCounter++;
        edittext = (TextView) v2;
        edittext.setText(String.valueOf(keys.get(s)));
    }
 
 }
 
 public void BackHome(View view)
	{
		Intent intent = new Intent(this, MainActivity.class) ;
		
		
		
		startActivity(intent) ; 
	}
 
}



